attribute vec3 color;
attribute float imgIndex;
attribute float aScale;

uniform float uTime;

varying vec3 vColor;
varying float vImgIndex;
varying float vAScale;

void main() {
    vColor = color;
    vImgIndex = imgIndex;
    vAScale = aScale;

    vec4 modelPosition = modelMatrix * vec4(position, 1.0);

    float angle = atan(modelPosition.z, modelPosition.x);
    float distanceToCenter = length(modelPosition.xz);
    float angleOffset = distanceToCenter * 0.3 + uTime;

    angle += angleOffset;
    modelPosition.x = cos(angle) * distanceToCenter;
    modelPosition.z = sin(angle) * distanceToCenter;

    vec4 viewPosition = viewMatrix * modelPosition;
    gl_Position = projectionMatrix * viewPosition;

    gl_PointSize = (100.0 + 50.0 * aScale) / -viewPosition.z;

}